package cn.com.nou.common;

import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * Swagger 配置
 * @author lixuefeng
 */
public class Swagger2Config {

    @Bean
    public Docket createDocker() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage(basePackage()))
                .paths(PathSelectors.any())
                .build();
    }

    protected String basePackage() {
        return "cn.com.nou";
    }

    protected ApiInfo apiInfo() {
        return new ApiInfoBuilder().title("API").description("API说明").version("1.0").build();
    }
}
